package com.zfp.core.controller;

/**
 * Created by 飞蓬 on 2017/8/6.
 */

import com.sun.beans.editors.DoubleEditor;
import com.sun.beans.editors.FloatEditor;
import com.sun.beans.editors.LongEditor;
import com.zfp.core.base.Base;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder;


/**
 *
 * <p>ClassName:BaseController</p>
 * <p>Description:所有Controller的基类</p>
 * @author wangxiaobo
 * @date 2015-11-3
 */
public abstract class BaseController extends Base {

    /**
     * 表单数据绑定，对于基本类型和日期的处理
     * @param binder
     */
    @InitBinder
    protected  void initBinder(WebDataBinder binder) {


        binder.registerCustomEditor(long.class, new LongEditor());
        binder.registerCustomEditor(double.class, new DoubleEditor());
        binder.registerCustomEditor(float.class, new FloatEditor());
    }
}
